package com.icss.company.exception;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.HashMap;
import java.util.Map;

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(RuntimeException.class)
    public Map<String,Object> handlerException(RuntimeException e){
        Map<String,Object> result = new HashMap<>();
        result.put("code","501");
        result.put("msg",e.getMessage());
        return result;
    }

}
